using Unity.Burst;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;

partial struct MoveSystem : ISystem
{
    [BurstCompile]
    public void OnCreate(ref SystemState state)
    {
        state.RequireForUpdate<MoveComponent>();
    }

    [BurstCompile]
    public void OnUpdate(ref SystemState state)
    {
        foreach(var (trans,mc)in SystemAPI.Query<RefRW<LocalTransform>,RefRO<MoveComponent>>()){
            trans.ValueRW.Position+=mc.ValueRO.dir*mc.ValueRO.speed*SystemAPI.Time.DeltaTime;;
        }
    }

    [BurstCompile]
    public void OnDestroy(ref SystemState state)
    {
        
    }
}
